package thirt.component
{
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.filters.GlowFilter;
	
	import mx.controls.Button;

	public class DButton extends Button
	{
		private var filt:GlowFilter;
		private var fade:Boolean;
		public function DButton()
		{
			super();
			filt = new GlowFilter(0x1c9cf6,1,8,8);
			this.addEventListener(MouseEvent.ROLL_OVER,onOver);
			this.addEventListener(MouseEvent.ROLL_OUT,onOut);
		}
		private function onOver(event:Event):void{
			fade = true;
			this.addEventListener(Event.ENTER_FRAME,onFrame);
		}
		private function onOut(event:Event):void{
			fade = false;
			this.addEventListener(Event.ENTER_FRAME,onFrame);
		}
		private function onFrame(event:Event):void{
			if(fade){
				if(filt.alpha <= 1){
					filt.alpha += 0.2;
				}else{
					this.removeEventListener(Event.ENTER_FRAME,onFrame);
				}
			}else{
				if(filt.alpha >= 0){
					filt.alpha -= 0.2;
				}else{
					this.removeEventListener(Event.ENTER_FRAME,onFrame);
				}
			}
			this.filters = [filt];
		}
		
		
	}
}